import config from "@/config"
import http from "@/utils/request"

export default {
	config:{
		config: {
			url: `${config.API_URL}/cfg/config.do`,
			name: "config",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		cfg: {
			url: `${config.API_URL}/cfg/get.do`,
			name: "cfg",
			get: async function(data, config = {}) {
				return await http.get(this.url, data, config);
			}
		},
	},
	menu: {
		myMenus: {
			url: `${config.API_URL}/system/menu`,
			name: "获取我的菜单",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		right: {
			url: `${config.API_URL}/menu/right.do`,
			name: "菜单",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		list: {
			url: `${config.API_URL}/menu/list.do`,
			name: "获取菜单",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		add: {
			url: `${config.API_URL}/menu/save.do`,
			name: "获取菜单",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		delete: {
			url: `${config.API_URL}/menu/delete.do`,
			name: "获取菜单",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
	},
	// 地区
	area: {
		tree: {
			url: `${config.API_URL}/region/tree.do`,
			name: "树",
			post: async function() {
				return await http.post(this.url);
			}
		},
		list: {
			url: `${config.API_URL}/region/list.do`,
			name: "列表",
			post: async function() {
				return await http.post(this.url);
			}
		},
		add: {
			url: `${config.API_URL}/region/save.do`,
			name: "新增/修改",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		delete: {
			url: `${config.API_URL}/region/delete.do`,
			name: "删除",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
	},
	dic: {
		tree: {
			url: `${config.API_URL}/system/dic/tree`,
			name: "获取字典树",
			get: async function() {
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.API_URL}/system/dic/list`,
			name: "字典明细",
			get: async function(params) {
				return await http.get(this.url, params);
			}
		},
		get: {
			url: `${config.API_URL}/system/dic/get`,
			name: "获取字典数据",
			get: async function(params) {
				return await http.get(this.url, params);
			}
		}
	},
	role: {
		list: {
			url: `${config.API_URL}/role/list.do`,
			name: "获取角色列表",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		save: {
			url: `${config.API_URL}/role/save.do`,
			name: "保存",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		delete: {
			url: `${config.API_URL}/role/delete.do`,
			name: "删除",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		info: {
			url: `${config.API_URL}/role/get.do`,
			name: "详细",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
	},
	dept: {
		list: {
			url: `${config.API_URL}/dept/tree.do`,
			name: "获取部门列表",
			post: async function(params) {
				return await http.post(this.url, params);
			}
		},
		save: {
			url: `${config.API_URL}/dept/save.do`,
			name: "保存",
			post: async function(params) {
				return await http.post(this.url, params);
			}
		},
		delete: {
			url: `${config.API_URL}/dept/delete.do`,
			name: "删除",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
	},
	//用户
	user: {
		getcfg: {
			url: `${config.API_URL}/user/getcfg.do`,
			name: "获取列表",
			post: async function(params) {
				return await http.post(this.url, params);
			}
		},
		config: {
			url: `${config.API_URL}/user/config.do`,
			name: "获取列表",
			post: async function(params) {
				return await http.post(this.url, params);
			}
		},
		list: {
			url: `${config.API_URL}/user/list.do`,
			name: "获取列表",
			post: async function(params) {
				return await http.post(this.url, params);
			}
		},
		save: {
			url: `${config.API_URL}/user/save.do`,
			name: "新增/修改",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		delete: {
			url: `${config.API_URL}/user/delete.do`,
			name: "删除",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
		pass: {
			url: `${config.API_URL}/user/change.do`,
			name: "修改密码",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
	},
	app: {
		list: {
			url: `${config.API_URL}/system/app/list`,
			name: "应用列表",
			get: async function() {
				return await http.get(this.url);
			}
		}
	},
	log: {
		list: {
			url: `${config.API_URL}/log/list.do`,
			name: "日志列表",
			post: async function(params) {
				return await http.post(this.url, params);
			}
		},
		login: {
			url: `${config.API_URL}/log/login.do`,
			name: "登录日志列表",
			post: async function(params) {
				return await http.post(this.url, params);
			}
		},
		delete: {
			url: `${config.API_URL}/log/delete.do`,
			name: "获取菜单",
			post: async function(data, config = {}) {
				return await http.post(this.url, data, config);
			}
		},
	},
	table: {
		list: {
			url: `${config.API_URL}/system/table/list`,
			name: "表格列管理列表",
			get: async function(params) {
				return await http.get(this.url, params);
			}
		},
		info: {
			url: `${config.API_URL}/system/table/info`,
			name: "表格列管理详情",
			get: async function(params) {
				return await http.get(this.url, params);
			}
		}
	},
	tasks: {
		list: {
			url: `${config.API_URL}/system/tasks/list`,
			name: "系统任务管理",
			get: async function(params) {
				return await http.get(this.url, params);
			}
		}
	}
}
